# -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 17:17:03 2020

@author: 1
"""

import numpy as np

def excel2array(csvfile_path):
   """ Read the .csv file and SKIP the 1st line
       We could use this function to read  raw/training.csv and  raw/annotation.csv
   Args:
       csvfile_path: the path of .csv
       
   """
   from itertools import islice
   row=[]
   input_file = open(csvfile_path)
   for line in islice(input_file, 1, None):
       row.append(line.split(','))
   return row

def generatedict(namelist , labellist):
    """Compose two List instances into a Dictionary
       the key is namelist, the value is labellist
    """
    labellist = [int(x) for x in labellist]
    return dict(zip(namelist , labellist))


def readfunc(csv_path):
    res = excel2array(csv_path)
    res = np.array(res)
    fileID_list = res[:,0]
    speciesID_list = res[:,1]
#    dict_name_label = generatedict(fileID_list , speciesID_list)
    return fileID_list, speciesID_list #, dict_name_label